<extend name="Base/common"/>
<block name="style">
<style type="text/css">
	.head{
		width:100%;
		height:100%;
		padding-top: 0px;
	}
	.formtijiao{
		width:93%;
		height:auto;
		margin:auto; 

	}

    p{
        width: 90%;
        height: auto;
        margin: auto;
        font-size: 12px;
        line-height: 20px;
        color:#FFC125;
        text-align: left;
        margin-top:0px; 

    }

    img{
        
        display: block;
        margin:auto;
    }
	label{
		display: block;
		height:45px;
	}
	label input{
		width:68%;
        height: 35px;
		float: right;
	}
	label img{
		width:68%;
        height:97%;
		float: right;
		border-radius: 3px 3px;
        border:1px dashed #999;
		margin-top: -20px;
	}

    body{

    }


    .changeform{
        width:90%;
        height:200px;
        background: #fff;
        margin-left: 5%;
        border-radius: 5px 5px;
        padding-top:5px;
    }

    .changeform label{
        display: block;
        height:45px;
        padding-left:5px;

    }
    .changeform input{
        width:60%;
        height: 30px;
        float: right;
        margin-right: 5px;


    }

    .tips{
        position:fixed;
        top:-10px;
        background: rgba(41,81,196,0.5);
        width:100%;
        color:#fff;
        font-size:16px;
        text-align: left;
        text-indent: 2em;
        line-height:45px;
        z-index: 99;
    }




   
</style>
</block>
<block name="body">
    <p class="tips"></p>
	<div class="head">
        <if condition="$type eq 1">
            <p>实名认证信息</p>
                <div style="margin-top:10px;width:90%;margin-left:5%">
                    <label>
                        姓&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;名：
                        <span>{$one.name}</span>
                    </label>
                    <label>
                        身份证号码：
                        <php>$str=substr($one['identify'], 0,2) .'******'.substr($one['identify'], -3) ;</php>
                        <span>{$str}</span>
                    </label>           
                </div>
            <elseif condition="$type eq 2"/>
                <p>个人信息</p>
                    <div style="margin-top:10px;width:90%;margin-left:5%">
                        <label>
                            登录账号：
                            <span>{$one.phone}</span>
                        </label>
                        <label>
                            店铺名称：
                            <span>{$one.shop_name}</span>
                        </label>
                        
                        <label>
                            手机号码：
                            <span>{$one.phone}</span>
                        </label>

                        <label>
                            支付宝账号：
                            <span>{$one.alipay}</span>
                        </label>          
                    </div>
            <elseif condition="$type eq 3"/>
                <p>支付宝修改</p>
                        <form method="post" action="" class="changeform">
                            <input type="hidden" name="phone"  value="{$one.phone}" class="mobile">
                            <label>
                            支付宝账号：
                            <input type="text" name="alipay" class="alipay"  value="{$one.alipay}">
                    </label> 
                            <button type="button" class="login-btn change_alipay" style="height:35px;">修 改</button>
                        </form>
            <elseif condition="$type eq 4"/>
                <p>密码修改</p>
                        <form method="post" action="" class="changeform">
                            <input type="hidden" name="phone"  value="{$one.phone}" class="mobile">
                            <label>
                                账号：
                                <input type="text" readonly value="{$one.phone}" class="account">
                            </label>
                            <label>
                                旧密码：
                                <input type="password" name="password" class="p">
                            </label>
                            <label>
                                新密码：
                                <input type="password" name="npassword" class="np">
                            </label>
                            <div class="yzm" style="height:40px;padding-left:5px;display:none">
                                手机验证码：
                                <div style="float:right;width:61.5%">
                                    <input type="text" name="code" style="width:50%;float:left;" class="code">
                                    <input type="button" class="get_code" style="width:45%;float:left;font-size:12px;" value="获取验证码">
                                </div>
                            </div>  
                            <button type="button" class="login-btn change" style="height:35px;display:none">修 改</button>
                        </form>
        </if>



	</div>


	
</block>



<block name="script">
<script type="text/javascript">

$('.changeform input').change(function(){
    var account=$('.account').val();
    var mobile= $('.mobile').val();
    var p=$('.p').val();
    var np= $('.np').val();
    var code=$('.code').val()
    if(account==''||mobile==''||p==''||np==''){
        $('.yzm').hide()
        $('.change').hide()
        $('.tips').html('请确认已填写新旧密码且新旧密码不可相同')
        setTimeout(function(){
            $('.tips').html('')
            
        },3000)
    }else{
        if(code==''){
            $('.yzm').show()
            $('.change').hide()
        }else{
            $('.yzm').show()
            $('.change').show()
        }
        
    }
})

$('.change_alipay').click(function(){
            var alipay=$('.alipay').val();
            var mobile= $('.mobile').val();
            $.ajax({
                type:'post',
                data:{'alipay':alipay,'phone':mobile},
                url:"{:U('pdata1')}",
                success:function(m){
                    if(m==0){
                        $('.tips').html('修改失败')
                        setTimeout(function(){
                            $('.tips').html('')
                            
                        },3000)
                    }else{
                        $('.tips').html('修改成功')
                        setTimeout(function(){
                            $('.tips').html('')
                            
                        },3000)
                    }
                }
            })

        })

    
        $('.get_code').click(function(){
                var mobile = $('.mobile').val();//手机号码
                $.ajax({
                    type:'post',
                    url:"{:U('Koubei/get_code')}",
                    data:{'mobile':mobile,'type':2},
                    success:function(m){
                        if(m==11){
                            $('.tips').html('验证码已发送，请注意查收')
                            setTimeout(function(){
                                $('.tips').html('')
                                
                            },3000)
                            // alert('验证码已发送，请注意查收')
                            // $('.tijiao').show();

                        }else{
                            alert(m)
                        }
                    }
                });

        });



        $('.change').click(function(){
            // alert(3)
            var data=$('.changeform').serializeArray();
            $.ajax({
                type:'post',
                data:data,
                url:"{:U('Koubei/change')}",
                success:function(m){
                    if(m==1){
                        $('.tips').html('修改成功')
                        setTimeout(function(){
                            $('.tips').html('')
                            
                        },3000)

                    }else if(m==2){
                        $('.change_p').hide()
                        $('.tips').html('修改失败')
                        setTimeout(function(){
                            $('.tips').html('')
                            
                        },3000)
                    }else{
                        $('.tips').html(m)
                        setTimeout(function(){
                            $('.tips').html('')
                            
                        },3000)
                    }
                }
            })

        })
    </script>

</block>